Server Side Includes are a simple way to introduce dynamic content into your web pages. SSIs are additional HTML tags (using the HTML comment format) which the server parses as the pages is uploaded- so the user's broswer never even sees the HTML tags (the information is substituted in place of the tag).SSI commands can even be used inside normal HTML tags. For instance, the link:
/"> This takes you to the Web Root of your machine.
...is generated by the HTML source:
<A HREF="http://<!--#echo var="server_name"-->/"> This takes you to the Web Root of your machine.</A>To use Server Side Includes you must name the file with a .shtml suffix. NetPresenz always looks for the .shtml file first. If you refer to a web page called "truffles.html", NetPresenz will first look for a document called "truffles.shtml", then it will look for document called "truffles.html".
The Server Side Include commands are detailed below. A functioning example is given for each command, along with the HTML source which generated it. I recommend looking at the source to this file to understand how SSIs work.
Document Information
These tags apply to the document in which they are inserted.Description: Name of the current document.
Format: <!--#echo var="document_name"-->
Example:<!--#echo var="document_name"--> gives:Description: Absolute path from the WWW Root Directory of the current document.
Format: <!--#echo var="document_uri"--> or <!--#echo var="script_name"-->
Example: <!--#echo var="document_uri"--> gives:Description: Displays the file size in bytes.
Format: <!--#fsize-->
Example: <!--#fsize--> gives:Description: Modification date of the current file.
Format: <!--#echo var="last_modified"-->
Example: <!--#echo var="last_modified"--> gives:
File Information
These tags are used to refer to other files.Description: Inserts the contents of the file "filename" into the HTML document at this point.
Format: <!--#include file="filename"-->
Example: <!--#include file="include.txt"--> gives:Description: Inserts the file size of the file "filename" in bytes.
Format: <!--#fsize file="filename"-->
Example: <!--#fsize file="include.txt"--> gives:Description: Inserts the modification date.
Format: <!--#flastmod file="filename"-->
Example: <!--#flastmod file="include.txt"--> gives:Note: Instead of using file="filename" you can use virtual="/fullpath/filename". The file argument is relative to the referring document, the virtual argument is an absolute path from the WWW Root Directory.
Counters
Counters are maintained internally by NetPresenz. Each counter is given a name. Every time the counter is accessed using the #counter tag NetPresenz increments the counter. Counters are maintained between quits.Description: Displays and increments the counter.
Format: <!--#counter var="counter_name"-->
Example: <!--#counter var="example-counter"--> gives:Description: Increments but doesn't display counter.
Format: <!--#silent_counter var="counter_name"-->
Example: <!--#silent_counter var="example-counter"--> gives:Description: Displays but doesn't increment the counter.
Format: <!--#echo var="counter_name">
Example: <!--#echo var="example-counter"> gives:Currently there is no way to zero a counter. Just use a different name.
Information About the Client
These tags insert information about the computer which is requesting the information.Description: The client's IP number.
Format: <!--#echo var="remote_host"--> or <!--#echo var="remote_addr"-->
Example: <!--#echo var="remote_host"--> gives:Description: The query string which was used to discover this document. May be blank.
Format: <!--#echo var="query_string"-->
Example: <!--#echo var="query_string"--> gives:
Server Information
Information about the server and the server machine.Description: The server's DNS Name.
Format: <!--#echo var="server_name"-->
Example: <!--#echo var="server_name"--> gives:Description: The server software's name and version number.
Format: <!--#echo var="server_software"-->
Example: <!--#echo var="server_software"--> gives:Description: The port the server software is running off (usually 80).
Format: <!--#echo var="server_port"-->
Example: <!--#echo var="server_port"--> gives:Description: The local time.
Format: <!--#echo var="date_local"-->
Example: <!--#echo var="date_local"--> gives: